import {patch} from "./vnode/patch";

export function mountComponent(vm, el) {
    vm._update(vm._render()) // vm._render 将 render 函数变成 vnode     vm._update将vnode变成真实DOM
}

export function lifecycleMixin(Vue) {
    Vue.prototype._update = function (vnode) {

        //console.log(vnode)
        let vm = this

        // 虚拟 >>> 真实
        vm.$el = patch(vm.$el, vnode)

    }
}

// 生命周期的调用
export function callHook(vm,hook){
    const handlers = vm.$options[hook]
    console.log(handlers)
}
